package com.yami.shop.cp.comment.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yami.shop.common.util.PageParam;
import com.yami.shop.cp.comment.dto.CPOrderDto;
import com.yami.shop.cp.comment.dto.CPSubmitPersonInfoAndSubmitStatus;
import com.yami.shop.cp.comment.dto.CollaborativePurchaseMergerDto;
import com.yami.shop.cp.comment.model.CollaborativePurchase;
import com.yami.shop.cp.comment.param.CPSearchParam;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author xch
 * @since 2021-06-23
 */
public interface CollaborativePurchaseMapper extends BaseMapper<CollaborativePurchase> {

    CollaborativePurchaseMergerDto queryCollaborativePurchaseMergerDto(@Param("userId") String userId, @Param("collaborativePurchaseId") String collaborativePurchaseId);

    /**
     * 条件查询，分页获取协同采购单
     *
     * @param page   分页参数
     * @param userId 用户id
     * @param status 查询采购单状态
     * @return IPage<CollaborativePurchase>
     */
    IPage<CollaborativePurchase> pageByUserIdAndStatus(PageParam page, @Param("userId") String userId, @Param("status") String status);

    /**
     * 条件查询，分页获取协同采购单
     *
     * @param page   分页参数
     * @param mobile 用户id
     * @param status 查询采购单状态（9位全部）
     * @return IPage<CollaborativePurchase>
     */
    IPage<CollaborativePurchase> pageBySubmitPersonIdAndStatus(PageParam page, @Param("mobile") String mobile, @Param("status") String status);

    List<CPSubmitPersonInfoAndSubmitStatus> getCPSubmitPersonInfoAndSubmitStatusById(@Param("collaborativePurchaseId") String collaborativePurchaseId);

    IPage<CollaborativePurchase> getSearchCP(PageParam page, @Param("cpSearchParam") CPSearchParam cpSearchParam);

    List<CollaborativePurchase> getSearchCP(@Param("cpSearchParam") CPSearchParam cpSearchParam);

    List<CPOrderDto> getCPOrderNumById(@Param("cpId")String cpId);
}
